package base.container;

import java.util.HashMap;
import java.util.Map;

public class TestMap3 {
	private static final Integer ONE = new Integer(1);
	private static final int j = 1;
	public static void main(String[] args) {
		Map map = new HashMap();
/*		for(int i=0;i<args.length;i++){
			Integer freq = (Integer) map.get(args[i]);
			map.put(args[i],freq == null? ONE:new Integer(freq.intValue()+1));			
		}
		System.out.println(map.size()+" distinct words detected:");
		System.out.println(map);*/
		
		//自动转换对象
		for(int i=0;i<args.length;i++){
			Integer freq = (Integer) map.get(args[i]);
			map.put(args[i],freq == null? ONE:j+1);			
		}
		System.out.println(map.size()+" distinct words detected:");
		System.out.println(map);
		
	}
	
	
	
	
}
